<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* location对象存着和URL相关的信息 */

        //属性
        //alert(location.host);//主机名+端口号
        // alert(location.hostname);//主机名
        //alert(location.port);//端口号
        // alert(location.href);//当前页面的地址

        // location.href = "https://www.jd.com";//为属性设置值  将网址变成了京东

        //函数

        function t1() {
            location.assign("https://www.jd.com");
        }
        function t2() {
            location.reload();

        }
        function t3() {
            location.replace("https://www.jd.com");
        }



    </script>
</head>

<body>

    <input type="button" value="载入新的文档" onclick="t1()">
    <input type="button" value="重新加载当前文档" onclick="t2()">
    <input type="button" value="替换文档" onclick="t3()">

</body>

</html>